package net.orange.framework.model;

/**
 * The resource type: 1)Public, everyone access.2)Internal, Only the login user
 * can access. 3)Restrict, Only the authorize user can access.
 */
public enum ResourceType {
	Restrict("R"), Internal("I"), Public("P");

	private String value;

	/**
	 * @param value
	 *            The value;
	 */
	ResourceType(String value) {
		this.value = value;
	}

	/**
	 * @return Returns the value.
	 */
	public String getValue() {
		return value;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return value;
	}

	/**
	 * Parse the string to Resource Type.
	 * 
	 * @return The resource type
	 */
	public static ResourceType parseOf(String s) {
		for (ResourceType rt : ResourceType.values())
			if (rt.getValue().equals(s))
				return rt;
		return null;
	}
}
